//
//  CalculatorEngine.h
//  iCalculator
//
//  Created by Stephen Houser on 9/7/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import "Calculator_Prefix.h"

#define INPUT_SIZE	100

// Change the int to float when _objc_msgSend_fpret is fixed
#define FLOAT_HACK	int

@interface CalculatorEngine : NSObject {

	// The definitive values are in the Strings!
	NSMutableString * display;	
	float	displayValue;	// the X register
	
	NSString * accumulator;
	float		accumulatorValue;

	NSString * memory;
	float	memoryValue;

	NSString * currentOperation;
	NSString * lastOperation;
	
	BOOL isResult;
	BOOL resetDisplay;
}

- (void) dumpAll: (NSString *)message;

- (id) init;
- (NSString *) getDisplay;
- (void) setDisplay: (NSString *)newDisplay;
- (void) setDisplayValue: (float)newDisplayValue;

- (NSString *) getAccumulator;
- (void) setAccumulator: (NSString *)newAccumulator;
- (void) setAccumulatorValue: (float)newAccumulatorValue;

- (NSString *) getMemory;
- (void) setMemory: (NSString *)newMemory;
- (void) setMemoryValue: (float)newMemoryValue;

- (void) sendCommand: (NSString *)command;

- (void) digit: (char)digit;
- (void) equals;

- (void) clearEntry;
- (void) clearAll;
- (void) add;
- (void) subtract;
- (void) multiply;
- (void) divide;
- (void) memoryClear;
- (void) memoryAdd;
- (void) memorySubtract;
- (void) memoryRecall;

- (void) binaryOperator: (NSString *)operator;
- (void) materializeValues;
- (void) evaluateOperation;
- (void) innerEvaluateOperation: (NSString *)operation;
@end

